import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {AuthGuardService} from '../services/auth-guard.service';
import {PortalDvComponent} from './datav/portal-dv.component';
import {AdminComponent} from './admin/admin.component';
import {AdminDashboardComponent} from './admin/admin-dashboard/admin-dashboard.component';
import {DatavDashboardComponent} from './datav/datav-dashboard/datav-dashboard.component';
import {BigScreenComponent} from './big-screen/big-screen.component';
import {BigScreenDashboardComponent} from './big-screen/big-screen-dashboard/big-screen-dashboard.component';
import {BigScreenAirqualityComponent} from './big-screen/big-screen-airquality/big-screen-airquality.component';
import {EmbeddedComponent} from './embedded/embedded.component';
import {EmbeddedDashboardComponent} from './embedded/embedded-dashboard/embedded-dashboard.component';

const routes: Routes = [
  {
    path: 'default',
    component: AdminComponent,
    canActivate: [AuthGuardService],
    children: [
      {
        path: '',
        component: AdminDashboardComponent
      },
      {
        path: 'admin',
        loadChildren: '../admin/admin.module#AdminModule'
      },
      {
        path: 'me',
        loadChildren: '../me/me.module#MeModule'
      }
    ]
  },
  {
    path: 'dv',
    component: PortalDvComponent,
    canActivate: [AuthGuardService],
    children: [
      {
        path: '',
        component: DatavDashboardComponent,
      },
      {
        path: 'admin',
        loadChildren: '../admin/admin.module#AdminModule'
      },
      {
        path: 'me',
        loadChildren: '../me/me.module#MeModule'
      }
    ]
  },
  {
    path: 'bs',
    component: BigScreenComponent,
    canActivate: [AuthGuardService],
    children: [
      {
        path: '',
        component: BigScreenDashboardComponent,
      },
      {
        path: 'air',
        component: BigScreenAirqualityComponent,
      },
      {
        path: 'admin',
        loadChildren: '../admin/admin.module#AdminModule'
      },
      {
        path: 'me',
        loadChildren: '../me/me.module#MeModule'
      }
    ]
  },
  {
    path: 'embedded',
    component: EmbeddedComponent,
    canActivate: [AuthGuardService],
    children: [
      {
        path: '',
        component: EmbeddedDashboardComponent,
      },
      {
        path: 'admin',
        loadChildren: '../admin/admin.module#AdminModule'
      },
      {
        path: 'me',
        loadChildren: '../me/me.module#MeModule'
      }
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
  providers: []
})
export class PortalsRoutingModule {
}
